﻿#ifndef _OI_PLSCANNERCORE_ACQUIRE_HPP_
#define _OI_PLSCANNERCORE_ACQUIRE_HPP_

#include "PLScannerCore/OiPLScannerCore.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        typedef void (*AcquireProfileCallback)(const OiProfile&, void*);

        typedef void(*AcquireValueCallback)(const double&, void* );

        class OI_PLSCANNER_CORE_API SensorAcquire : public QObject
        {
            Q_OBJECT

        public:
            SensorAcquire();
            ~SensorAcquire();

        public:
            void init();
            void exit();

       signals:
            void enterAcquire();
            void leaveAcquire();

        public:
            bool isWorking();

            bool acquire(AcquireProfileCallback callback, void* data, OiProfile& retValue, bool& direction, double vel, double from = 0.0, double end = 0.0, bool blocking = false, int timeout = -1);

            bool acquire(AcquireValueCallback callback, void* data, double& retValue, double pos = 0.0, bool blocking = true, int looptime = 100, int timeout = -1);

            bool acquire(const QString file, OiProfile& retValue);

            bool readTemperature(double & value1, double & value2);

       public slots:
            void abort();
            void onLeaveAcquire();

        public:
            static SensorAcquire* OiAcquire();

        private:
            OI_DISABLE_COPY(SensorAcquire);
            OI_DECLARE_IMPL(SensorAcquire);
        };
    }
}


#endif // _OI_PLSCANNERCORE_ACQUIRE_HPP_
